-
Notifications
You must be signed in to change notification settings - Fork 5
Sphere grid memory mapping #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
sphere_grid_reader.py
Outdated
print(f"Node at idx=123 is {node_123}") | ||
|
||
last_node = 0 | ||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this to actually run forever? Because this doesn't have a break or a return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment below.
sphere_grid_reader.py
Outdated
from memory.sphere_grid import SphereNodeType, sphere_grid | ||
|
||
# Wait for memory to finish loading | ||
while not memory.main.start(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably worth wrapping most of this stuff in a function. The act of importing this file would do bad things right now. Lol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment clarifying that this file is not meant to be integrated into the TAS, only serve as an example on how to use the API.
memory/sphere_grid.py
Outdated
"""This returns a one byte bitfield, where each bit indicates that a character has activated this node.""" | ||
return read_val(self.offset + self._ACTIVATED_BY_OFFSET, 1) | ||
|
||
def is_activated_by(self, character_id: int) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we lean into the new world here. Instead of passing in character_id: int
, I'd rather see character: Player
, then we either implement the bitwise operator for the class or grab the id off the player object further down.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm inclined to agree with you. I'll make some tweaks and test.
Implementation of #180
A small API to read out the state of the sphere grid. Also contains an example app that uses the API.